﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236

namespace App12
{
    public sealed partial class MyControl : UserControl
    {
        public MyControl()
        {
            this.InitializeComponent();
        }
    }

    public class MyControlViewModel : BindableBase
    {
        public int Number
        {
            get { return (int)GetValue(NumberProperty); }
            set
            {
                SetValue(NumberProperty, value);
                base.RaisePropertyChanged();
            }
        }
        public static readonly DependencyProperty NumberProperty =
            DependencyProperty.Register("Number", typeof(int), typeof(MyControlViewModel),
            new PropertyMetadata(0, (s, e) => { }));

        public string Letter
        {
            get { return (string)GetValue(LetterProperty); }
            set
            {
                SetValue(LetterProperty, value);
                base.RaisePropertyChanged();
            }
        }
        public static readonly DependencyProperty LetterProperty =
            DependencyProperty.Register("Letter", typeof(string), typeof(MyControlViewModel),
            new PropertyMetadata("Z", (s, e) => { }));

        public ObservableCollection<string> Letters
        {
            get { return (ObservableCollection<string>)GetValue(LettersProperty); }
            set
            {
                SetValue(LettersProperty, value);
                base.RaisePropertyChanged();
            }
        }
        public static readonly DependencyProperty LettersProperty =
            DependencyProperty.Register("Letters", typeof(ObservableCollection<string>),
            typeof(MyControlViewModel),
            new PropertyMetadata(new ObservableCollection<string>(new[] { "~W", "~X", "~Y", "~Z" }), (s, e) => { }));
    }
}
